home *** CD-ROM | disk | FTP | other *** search
- <!--//--><script language="javascript">
- /*
- This file handles the installing and updating of the TKM.
-
- File Dependencies:
- objRO.js The Request Object (ro)
-
- Required Initialization Method:
- TI_Init Sets the this.binpath field based on the scenario and checks installation status.
- */
-
- function TKMINSTALLER()
- {
- // Methods used to check for and control installation status
- this.UpdateInstallStatus = TI_UpdateInstallStatus;
- this.CheckInstall = TI_CheckInstall;
- this.Install = TI_Install;
- this.InstallIE = TI_InstallIE;
- this.InstallNN = TI_InstallNN;
- this.Init = TI_Init;
-
- // Constants
- this.NOT_INSTALLED = 0;
- this.UPDATE_REQ = 1;
- this.INSTALLED = 2;
- this.PATCH_REQ = 3;
-
- this.version = '5.0.0.0';
-
- this.status = this.NOT_INSTALLED;
-
- // Fields
- var ro = new REQUESTOBJECT();
- if (ro.install_inprocess)
- {
- // If in PATCH scenario then use the Dummy classid and FileUpdater cab
- if(ro.type == 'patch')
- {
- this.clsid = 'ffffffff-ffff-dddd-cccc-aaaaaaaaaaaa'; // Dummy classid
- this.cab = 'frupd.cab#Version=4,0,0,33';
- this.jar = 'frupd.jar';
- }
- else
- {
- this.clsid = '8AC0DECF-701B-11D3-8EA6-009027232FFE'; // Use the classid of the tkmupdater.dll
- this.cab = 'tkm.cab#Version=5,0,0,0';
- this.jar = 'tkm.jar';
- }
- this.install_inprocess = true;
- }
- else
- {
- //this.clsid = '8965146F-DAE3-11D2-8EA1-009027232FFE'; // Use the classid of the pluginchecker.dll
- this.clsid = '8AC0DECF-701B-11D3-8EA6-009027232FFE'; // TKMUpdater.dll
- this.install_inprocess = false;
- }
-
- // If we have passed in a state it is so we can persist the state through an installation process
- // and allow the user to cancel without generating an incorrect installation status.
- if (ro.tkm_status) this.status = parseInt(ro.tkm_status)
-
- this.bootstrapInstalled = false;
- this.binpath = '';
- }
-
- function TI_Install()
- {
- if (this.install_inprocess)
- {
- if (document.layers) this.InstallNN();
- else if (document.all) this.InstallIE();
- }
- else
- {
- // If it's a Patch then attach 'type' in the query string
- if(this.status == this.PATCH_REQ) var install_fr = g_sTKMRoot + 'html/install_fr.htm?type=patch&tkm_status=' + this.status + '&reset_page=' + escape(location.href);
- else var install_fr = g_sTKMRoot + 'html/install_fr.htm?tkm_status=' + this.status + '&reset_page=' + escape(location.href);
- if (location.search != '') install_fr += '&reset_page_qstring=' + location.search.substring(1, location.search.length);
-
- self.location.replace(install_fr);
- }
- }
-
- function TI_InstallIE()
- {
- var sHTML = '';
-
- sHTML = '<object id="SelfUpdater" name="SelfUpdater" style="position:absolute; z-index:-1; visibility:hidden" ' +
- 'classid="clsid:' + this.clsid + '" height="0" width="0" codebase="' + this.binpath + this.cab + '"></object>';
-
- if (document.readyState == 'complete') document.body.insertAdjacentHTML('BeforeEnd', sHTML);
- else document.write(sHTML);
-
- setTimeout('ti.UpdateInstallStatus()', 3000);
- }
-
- function TI_InstallNN()
- {
- var sHTML = '';
- var jarFile = this.binpath + this.jar;
- netscape.softupdate.Trigger.StartSoftwareUpdate(jarFile, netscape.softupdate.Trigger.SILENT_MODE);
- setTimeout('ti.UpdateInstallStatus()', 3000);
- }
-
- function TI_UpdateInstallStatus()
- {
- // This is our "main brain" function. This baby gets called every so often (at the time
- // of it's creation it was set to every 2 seconds). It reloads the "detection" frame which
- // SHOULD get a brand spankin' new list of installed 'stuff'. When that frames script sees the
- // bootstrap installer plugin it will then tell this page via the setLoaderStatus() function.
- // The setLoaderStatus() function sets a flag that tells this function NOT to load the plugin
- // detection page, but rather the plugin launching page. When the bootstrap installer plugin
- // finishes it will cause that page to load not the plugin launching page, but a page that
- // will reload this page (with this page - install_main.htm at the time of this writing).
- // NOW - this page should have a brand spankin' new list of installed 'stuff' - which should
- // by this time contain the stuff that the bootstrap.exe application has force fed to Navigator!!!!
- //
- // Next time I recommend using the built it Navigator update stuff ala SmartUpdate, instead of
- // this HACK!
-
- if (document.layers)
- {
- if (!this.bootstrapInstalled)
- {
- parent.frames['install_detect'].location.replace(g_sTKMRoot + "html/install_detect_step1.htm");
- if (this.status != this.INSTALLED) setTimeout('ti.UpdateInstallStatus()', 3000);
- }
- else
- {
- navigator.plugins.refresh(true);
- parent.frames['install_detect'].location.replace(g_sTKMRoot + "html/install_detect_step2.htm");
- }
- }
- else if (document.all)
- {
- if (!this.bootstrapInstalled)
- {
- parent.frames['install_detect'].location.replace(g_sTKMRoot + "html/install_detect_step1.htm");
- if (this.status != this.INSTALLED) setTimeout('ti.UpdateInstallStatus()', 3000);
- }
- else
- {
- parent.frames['install_detect'].location.replace(g_sTKMRoot + "html/install_detect_step3.htm");
- }
- }
- }
-
- function setLoaderStatus()
- {
- // this is called by our other frame to inform us
- // when the bootstrap plugin has been installed into netscape
- // At this point, put an instance of our bootstrap plugin on the page.
- ti.bootstrapInstalled = true;
- }
-
- function TI_CheckInstall()
- {
- if (document.layers)
- {
- /* If the install_inprocess flag is set then just kick-off the install without checking */
- if (this.install_inprocess)
- {
- this.InstallNN();
- }
- else
- {
- // check for plugin thingy
- for (i=0; i<navigator.mimeTypes.length; i++)
- {
- if (navigator.mimeTypes[i].type == 'application/x-weboutfitter-container')
- {
- document.write('<embed type="application/x-weboutfitter-container" ' +
- //'name="WTM" width="" height="" clsid="{' + this.clsid + '}">');
- 'name="WTM" width="" height="" clsid="{8965146F-DAE3-11D2-8EA1-009027232FFE}">');
-
- var TU_ver = new String(document.WTM.callMethod1('GetVersion', 'tkmupdater.dll')) + '';
- var PC_ver = new String(document.WTM.callMethod1('GetVersion', 'FileRetriever.dll')) + '';
- var rVal = CompareVersions(PC_ver, this.version);
-
- if (TU_ver == 'FILE NOT FOUND' || rVal < 0) this.status = this.UPDATE_REQ;
- else this.status = this.INSTALLED;
-
- break;
- }
- }
- }
- }
- else if (document.all)
- {
- var sHTML = '';
-
- if (this.install_inprocess)
- {
- /* If the install_inprocess flag is set then just kick-off the install without checking */
- this.InstallIE();
- }
- else
- {
- document.write('<object id="WTMCheck" name="WTMCheck" style="position:absolute; z-index:-1; visibility:hidden" ' +
- 'classid="clsid:' + this.clsid + '" height=0 width=0></object>');
- if (document.WTMCheck.readyState != 0)
- {
- var TU_ver = document.WTMCheck.GetTKMFileVersion('tkmupdater.dll');
- var PC_ver = document.WTMCheck.GetTKMFileVersion('FileRetriever.dll');
- var rVal = CompareVersions(PC_ver, this.version);
-
- if (TU_ver == 'FILE NOT FOUND' || rVal < 0) this.status = this.UPDATE_REQ;
- else this.status = this.INSTALLED;
- document.WTMCheck.FreeUnusedLibraries();
- }
- }
- }
- }
-
- function CompareVersions(Ver0, Ver2)
- {
- var Ver1 = Ver0.toString();
-
- var aVer1 = Ver1.split(".");
- var aVer2 = Ver2.split(".");
-
- if(aVer1.length < 2) aVer1 = Ver1.split(",");
-
- if(aVer2.length < 2) aVer2 = Ver2.split(",");
-
- var nVer1, nVer2;
- for(var i = 0; i<4; i++)
- {
- nVer1 = nVer2 = 0;
- if(aVer1.length > i)
- {
- nVer1 = Number(aVer1[i]);
- if(isNaN(nVer1)) nVer1 = -1;
- }
- if(aVer2.length > i)
- {
- nVer2 = Number(aVer2[i]);
- if(isNaN(nVer2)) nVer2 = -1;
- }
- if(nVer1 > nVer2) return 1;
- else if(nVer1 < nVer2) return -1;
- }
- return 0;
- }
-
- function TI_Init(scenario)
- {
- // 1: WOTK_SCENARIO_CD (CD Scenario)
- // 2: WOTK_SCENARIO_EQUIP_PC (Equip Your PC Scenario)
- // 3: WOTK_SCENARIO_SITE_SEEING (Site Seeing/Theme Affiliate[TechTrek] Scenario)
- // 4: WOTK_SCENARIO_INDICATOR (Indicator Scenario)
- // 5: WOTK_SCENARIO_AFFILIATE (Persistant Branding Frame Scenario)
-
- var nEndPos = location.href.lastIndexOf('/');
- if (scenario == 1)
- {
- var sPath = location.href.substring(0, nEndPos);
- nEndPos = sPath.lastIndexOf('/');
- this.binpath = sPath.substring(0, nEndPos) + '/bootstrap/';
- }
- else this.binpath = g_sTKMRoot + 'bin/';
-
- /* Check the client software instalation status */
- this.CheckInstall();
- }
-
- var ti = new TKMINSTALLER();
- //--></script>